#pragma once
#include <wdm.h>

namespace windows {
namespace kernal {
class Device {
 public:
  static VOID CancelRoutine(_Inout_ struct _DEVICE_OBJECT *DeviceObject,
                            _Inout_ struct _IRP *Irp);

  static VOID StartIo(_Inout_ struct _DEVICE_OBJECT *DeviceObject,
                      _Inout_ struct _IRP *Irp);

  static NTSTATUS ReadDispatch(_In_ PDEVICE_OBJECT device_object, _In_ PIRP irp);

 public:
  Device(PDRIVER_OBJECT driver_object);
  ~Device();
  NTSTATUS Create(_In_ LPCWSTR device_name, _In_ LPCWSTR symbolic_link_name);
  VOID Destroy();

  VOID StartPacket(_In_ PIRP irp, _In_ PDRIVER_CANCEL cancel_routine);
  PIRP StartNextPacket();
  

 private:
  NTSTATUS CreateDevice(_In_ LPCWSTR device_name);

  NTSTATUS CreateSymbolicLink(_In_ LPCWSTR symbolic_link_name);

  NTSTATUS FormatDeviceName(_In_ LPCWSTR device_name,
                            _Out_ LPWSTR standard_device_name,
                            _Inout_ SIZE_T &size);

  NTSTATUS FormatSymbolicLinkName(_In_ LPCWSTR symbolic_link_name,
                                  _In_ LPWSTR standard_symbolic_link_name,
                                  _Inout_ SIZE_T &size);

 private:
  PDRIVER_OBJECT driver_object_;
  WCHAR device_name_[0x100];
  WCHAR symbolic_link_name_[0x100];
  PDEVICE_OBJECT device_object_;
  KDEVICE_QUEUE read_irp_queue_;
};

//class DeviceWrapper {
// public:
//  VOID Cleanup();
//
//  Device *device_;
//};
}
};




